package com.hupu.greap.mysql_db;

import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class HupuMysql{
     private static java.sql.Connection conn;
    public  void mysqlconnect() throws SQLException {
        String url="jdbc:mysql://localhost:3306/hupu";
        String username="root";
        String password="123456";
        conn = DriverManager.getConnection(url, username, password);
    }
    public void insert(String center,String timer) throws SQLException {
        mysqlconnect();
        String sql = "INSERT INTO hupu (center,time) VALUES (?, ?)";
        PreparedStatement statement = conn.prepareStatement(sql);
        statement.setString(1, center);
        statement.setString(2, timer);
        statement.executeUpdate();
        statement.close();
        conn.close();
    }


}
